package org.zttc.itat.dome;

import java.util.List;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.zttc.itat.model.Sort;
import org.zttc.itat.model.SortType;
import org.zttc.itat.service.ISortService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("/beans.xml")
public class TestSort {
	
	@Resource(name="sortService")
	private ISortService sortService;
    
	@Test
	public void testAdd(){
		Sort sort = new Sort();
		sort.setSortname("商会介绍");
		sortService.add(sort);
		sort = new Sort();
		sort.setSortname("商会动态");
		sortService.add(sort);
		sort = new Sort();
		sort.setSortname("渝商风采");
		sortService.add(sort);
		sort = new Sort();
		sort.setSortname("渝州动态");
		sortService.add(sort);
		sort = new Sort();
		sort.setSortname("信息快递");
		sortService.add(sort);
		sort = new Sort();
		sort.setSortname("申请入会");
		sortService.add(sort);
		sort = new Sort();
	}
	@Test
	public void testSort(){
		List<SortType> sortTypes = sortService.listScopeSort(1);
		for(SortType s:sortTypes){
			System.out.println(s.getName());
		}
	}
	
	@Test
	public void testSort2(){
		Sort sortTypes = sortService.load(6);
		System.out.print(sortTypes.getEnglishfield());
	}
}
